﻿
using AntdUI;
using ImportPlcPointPosition.Core;
using SqlSugar;
using SqlSugar.Extensions;
using System.ComponentModel.DataAnnotations.Schema;

namespace ZR.Model.Models.ProductionControl
{
    /// <summary>
    /// 工艺路线
    /// </summary>
    [SugarTable("cks_technical_flow_nodes")]
    public class CksTechnicalFlowNodes : BaseEntity
    {
        /// <summary>
        /// Id 
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        /// <summary>
        /// 节点编号 
        /// </summary>
        public int NodeId { get; set; }

        /// <summary>
        /// 说明 
        /// </summary>
        public string Notes { get; set; } = string.Empty;

        /// <summary>
        /// 虚拟表ID 
        /// </summary>
        public int TableId { get; set; }

        [SugarColumn(IsIgnore =true)]
        public CellButton TableItem
        {
            get
            {
                return new CellButton(this.Id.ToString(), CellButtonHelper.GetTableName(this.TableId))
                {
                    //支持所有单元格控件
                    //支持所有单元格控件
                    DropDownItems = CellButtonHelper.TableDropDownItems,
                    DropDownValueChanged = (value) =>
                    {
                        TableId = value.ObjToInt();
                        
                        OnPropertyChanged("TableItem");
                    }
                };

            }

        }

        /// <summary>
        /// 是否允许重复加工 
        /// </summary>
        public bool AllowReprocess { get; set; }

        /// <summary>
        /// 是否允许OK件重复加工 
        /// </summary>
        public bool AllowOkReprocess { get; set; }

        /// <summary>
        /// 结果是否必须OK 
        /// </summary>
        public bool RequireOk { get; set; }

        /// <summary>
        /// 前置节点编号 
        /// </summary>
        public int PreNodeId { get; set; }

        /// <summary>
        /// 是否验证前置节点 
        /// </summary>
        public bool NeedPrevCheck { get; set; }

        /// <summary>
        /// 禁用状态 
        /// </summary>
        public bool Nullity { get; set; }

        /// <summary>
        /// CreatedTime 
        /// </summary>
        public DateTime CreatedTime { get; set; } = DateTime.Now;

        

    }
}